package com.nopay.dxdwphone.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.nopay.dxdwphone.bean.request.SaveCallTaskRequest;

import java.util.List;
import com.nopay.dxdwphone.R;

public class ImportByClipBoardAdapter extends BaseAdapter {

    private List<SaveCallTaskRequest.Data> dataList;
    private LayoutInflater mInflater;

    public ImportByClipBoardAdapter(Context context, List<SaveCallTaskRequest.Data> dataList) {
        super();
        mInflater = LayoutInflater.from(context);
        this.dataList = dataList;
    }

    @Override
    public int getCount() {
        return dataList.size();
    }

    @Override
    public SaveCallTaskRequest.Data getItem(int position) {
        return dataList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if(convertView == null) {
            holder = new ViewHolder();
            convertView = mInflater.inflate(R.layout.adapter_import_by_clip_board, null);
            holder.tv_phone = convertView.findViewById(R.id.tv_phone);

            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        holder.tv_phone.setText(getItem(position).getPhone());
        return convertView;
    }

    public class ViewHolder {
        private TextView tv_phone;
    }
}
